/*
 * @Author: PC9527\Jack sophia2152@qq.com
 * @Date: 2023-08-07 15:55:13
 * @LastEditors: PC9527\Jack sophia2152@qq.com
 * @LastEditTime: 2023-08-07 16:08:42
 * @Description:
 */
import { MenusList, MenusListItem, MenusListParams, MenusParams } from './model/menusModel';
import { defHttp } from '/@/utils/http/axios';

enum Api {
  MenusList = '/system/menus/list',
  CreateMenus = '/system/menus/create',
  UpdateMenus = '/system/menus/update',
  DeleteMenus = '/system/menus/delete',
  MenusAll = 'system/menus/get-tree',
}

export const getMenusList = (params: MenusListParams) =>
  defHttp.get<MenusListItem>({ url: Api.MenusList, params });

export const createMenus = (params: MenusParams) => defHttp.post({ url: Api.CreateMenus, params });

export const updateMenus = (id: number, params: MenusParams) =>
  defHttp.put({ url: `${Api.UpdateMenus}/${id}`, params });

export const delMenus = (id: number) => defHttp.delete({ url: `${Api.DeleteMenus}/${id}` });

export const getMenusTree = () => defHttp.get<MenusList>({ url: Api.MenusAll });
